#include <stdio.h>

#define MAX_NUM 50000

typedef unsigned long u32;

typedef struct {
    u32 recData;
    u32 minMsecond;
    int count;
} Record;

Record g_record[MAX_NUM] = { 0 };
int g_num = 0;

void save(u32 year, u32 month, u32 date, u32 hour, u32 min, u32 second, u32 mscond)
{
    u32 recData = (second << 0) | (min << 6) | (hour << 12) | (date << 17) | (month << 22) | ((year - 2000) << 26);
    int i;
    for (i = 0; i < g_num; i++) {
        if (g_record[i].recData != recData) {
            continue;
        }

        if (mscond == g_record[i].minMsecond) {
            g_record[i].count++;
        }
        else if (mscond < g_record[i].minMsecond) {
            g_record[i].minMsecond = mscond;
            g_record[i].count = 1;
        }
        break;
    }

    if (i >= g_num) {
        g_record[g_num].recData = recData;
        g_record[g_num].minMsecond = mscond;
        g_record[g_num].count = 1;
        g_num++;
    }
}

int calc(void)
{
    int sum = 0;
    for (int i = 0; i < g_num; i++) {
        sum += g_record[i].count;
    }
    return sum;
}

int main(int argc, char const* argv[])
{
    freopen("./in.txt", "r", stdin);
    u32 year, month, date, hour, min, second, mscond;
    while (scanf("%04d-%02d-%02d %02d:%02d:%02d.%03d",
        &year, &month, &date, &hour, &min, &second, &mscond) != EOF) {
        save(year, month, date, hour, min, second, mscond);
    }
    printf("%d\n", calc());

    return 0;
}